package com.ioffice.export.excel.engine.data.excel.impl.line;

import java.util.ArrayList;
import java.util.List;

import com.ioffice.exception.IOfficeException;
import com.ioffice.export.excel.data.ExcelSheetDataInfo;
import com.ioffice.export.excel.engine.data.excel.impl.AbstractEngineDataSheetCompent;
import com.ioffice.export.excel.sheet.line.SheetDataBodyLine;
import com.ioffice.export.excel.type.ExcelSheetLineType;
import com.ioffice.export.excel.type.ExcelSheetType;

public class EngineDataExcelSheetLineDataBody extends AbstractEngineDataSheetCompent{

	private int level=0;
	private ExcelSheetDataInfo parentData=null;
	private int deepCount=0;
	
	
	public EngineDataExcelSheetLineDataBody() {
		compent=new SheetDataBodyLine();
	}
	
	@Override
	public void data2SheetCompent(List<ExcelSheetDataInfo> datas,ExcelSheetType sheetType) throws IOfficeException {
		int childCount=datas.size();
		for(int i=0;i<childCount;i++){
		
			parentData=datas.get(i);
			
		}
	}

	
	public static void main(String[] args) {
		List<ExcelSheetDataInfo> datas =new ArrayList<ExcelSheetDataInfo>();
		ExcelSheetDataInfo dataInfo_1=new ExcelSheetDataInfo();
		dataInfo_1.setChildLevel(0);
		dataInfo_1.setId(1);
		dataInfo_1.setParentId(0);
		dataInfo_1.setValue("卡号");
		datas.add(dataInfo_1);
		
		ExcelSheetDataInfo dataInfo_2=new ExcelSheetDataInfo();
		dataInfo_2.setChildLevel(0);
		dataInfo_2.setId(2);
		dataInfo_2.setParentId(0);
		dataInfo_2.setValue("卡号111");
		datas.add(dataInfo_2);
		
		ExcelSheetDataInfo dataInfo_2_1=new ExcelSheetDataInfo();
		dataInfo_2_1.setChildLevel(1);
		dataInfo_2_1.setId(3);
		dataInfo_2_1.setParentId(2);
		dataInfo_2_1.setValue("2_1");
		datas.add(dataInfo_2_1);
		
		ExcelSheetDataInfo dataInfo_2_1_1=new ExcelSheetDataInfo();
		dataInfo_2_1_1.setChildLevel(2);
		dataInfo_2_1_1.setId(4);
		dataInfo_2_1_1.setParentId(3);
		dataInfo_2_1_1.setValue("2_1_1");
		datas.add(dataInfo_2_1_1);
		
		ExcelSheetDataInfo dataInfo_2_1_2=new ExcelSheetDataInfo();
		dataInfo_2_1_2.setChildLevel(3);
		dataInfo_2_1_2.setId(5);
		dataInfo_2_1_2.setParentId(4);
		dataInfo_2_1_2.setValue("2_1_2");
		datas.add(dataInfo_2_1_2);
		
		ExcelSheetDataInfo dataInfo_2_1_3=new ExcelSheetDataInfo();
		dataInfo_2_1_3.setChildLevel(4);
		dataInfo_2_1_3.setId(6);
		dataInfo_2_1_3.setParentId(5);
		dataInfo_2_1_3.setValue("2_1_3");
		datas.add(dataInfo_2_1_3);
		
		
		
		ExcelSheetDataInfo dataInfo_2_2=new ExcelSheetDataInfo();
		dataInfo_2_2.setChildLevel(1);
		dataInfo_2_2.setId(8);
		dataInfo_2_2.setParentId(2);
		dataInfo_2_2.setValue("2_2");
		datas.add(dataInfo_2_2);
		
		ExcelSheetDataInfo dataInfo_2_2_1=new ExcelSheetDataInfo();
		dataInfo_2_2_1.setChildLevel(2);
		dataInfo_2_2_1.setId(9);
		dataInfo_2_2_1.setParentId(8);
		dataInfo_2_2_1.setValue("2_2_1");
		datas.add(dataInfo_2_2_1);
		
		ExcelSheetDataInfo dataInfo_2_2_2=new ExcelSheetDataInfo();
		dataInfo_2_2_2.setChildLevel(3);
		dataInfo_2_2_2.setId(10);
		dataInfo_2_2_2.setParentId(9);
		dataInfo_2_2_2.setValue("2_2_2");
		datas.add(dataInfo_2_2_2);
		
		ExcelSheetDataInfo dataInfo_2_2_3=new ExcelSheetDataInfo();
		dataInfo_2_2_3.setChildLevel(4);
		dataInfo_2_2_3.setId(11);
		dataInfo_2_2_3.setParentId(10);
		dataInfo_2_2_3.setValue("2_2_3");
		datas.add(dataInfo_2_2_3);
		
		ExcelSheetDataInfo dataInfo_3=new ExcelSheetDataInfo();
		dataInfo_3.setChildLevel(0);
		dataInfo_3.setId(12);
		dataInfo_3.setParentId(0);
		dataInfo_3.setValue("合并一");
		datas.add(dataInfo_3);
		
		ExcelSheetDataInfo dataInfo_4=new ExcelSheetDataInfo();
		dataInfo_4.setChildLevel(0);
		dataInfo_4.setId(13);
		dataInfo_4.setParentId(0);
		dataInfo_4.setValue("合并二");
		datas.add(dataInfo_4);
		
		ExcelSheetLineType type=new ExcelSheetLineType();
		
		type.setDatabodyParentId(0);
		
		try{
			EngineDataExcelSheetLineDataBody body=new EngineDataExcelSheetLineDataBody();
			body.data2SheetCompent(datas, type);
			SheetDataBodyLine bodyLine=(SheetDataBodyLine)body.getSheetGenericCompent();
			System.out.println(bodyLine);
		}catch(IOfficeException e){
			System.out.println(e.toString());
		}
	}
}
